<HTML>
<HEAD>
<TITLE>JavaScript Source Code 3000:  Miscellaneous:  Midi Menu</TITLE>
<META HTTP-EQUIV="JavaScript Source Code 3000" CONTENT = "no-cache">
<META NAME="date" CONTENT="2000-09-09">
<META NAME="channel" CONTENT="Web Developer">
<META NAME="author" CONTENT="Nicholas Loar">
<META NAME="section" CONTENT="Miscellaneous">
<META NAME="description" CONTENT="Select a song from the pulldown menu and it becomes the background music on the page.">

<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Nicholas Loar -->
<!-- Web Site:  http://www.cass.net/~anarchy -->




<!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "../img/midi-menu/whiskey.mid";
songNum[2] = "../img/midi-menu/aeroplane.mid";
songNum[3] = "../img/midi-menu/christina.mid";
songNum[4] = "../img/midi-menu/hell.mid";

var music = null;
var track = 0;
var ver = navigator.appName;
function audioCheck(plugName) {
for (var i = 0; i < navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {
for (var j = 0; j < navigator.plugins[i].length; j++) {
if (navigator.plugins[i][j].enabledPlugin) {
return true;
   }
}
return false;
   }
}
return false;
}
function chooseSong(s) { // ie
track = s.options[s.selectedIndex].value; 
if (ver == "Microsoft Internet Explorer") {
document.all.music.src = songNum[track]; 
} else {
songPlay('play');
   }
}
function songPlay(cmd) { // netscape
if (audioCheck("LiveAudio")) {
if (cmd == 'play') {
document.musicSource.play(false, songNum[track]);
   }
} else {
alert("You Do Not Have The Correct Plugin");
   }
}
//  End -->
</script>
</HEAD>

<BODY BGCOLOR=#ffffff vlink=#0000ff>

<BR>
<center>
<table width=600 cellpadding=0 cellspacing=10>
<tr>
<td width=468 align=center>

    
    
</td>
<td width=120 align=center>
    
</td>
</tr>
</table>
<BR>
<BR>
<basefont size=3>
<FONT SIZE="+2" FACE="Helvetica,Arial">
<A HREF="../index.htm" /" TARGET="_top"><FONT COLOR="#0000FF"><b>Home</b></font></A>
<img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}">
<A HREF="index.htm" /miscellaneous/"><font color="#FF0000"><b>Miscellaneous</b></font></A>
<img src="../img/arrow.gif" /img/arrow.gif" height=13 width=7 border=0 alt="}">
<FONT COLOR="#006666"><b>Midi Menu</b></font></font>
<BR>
<BR>
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td><font FACE="helvetica,arial,geneva">
<br>
<br>
<!-- Description --><!--content_start-->
Select a song from the pulldown menu and it becomes the background music on the page.
<hr>
</td></tr>
</table>
<!-- Demonstration -->
<center>
<form name=choose>
<select size=1 name=track onChange="chooseSong(this);">
<option value="0">Click For Music</option>
<option value="1">Whiskey In A Jar</option>
<option value="2">Aeroplane</option>
<option value="3">Genie In A Bottle</option>
<option value="4">Hell</option>
</select>
<input type=button onMouseDown="chooseSong(document.choose.track)" value=" Play ">
</form>

<script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="aeroplane.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
</center>
<P>
<P>
<a name="source">
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td BGCOLOR=yellow><font FACE="helvetica,arial,geneva"><b>JavaScript Source Code 3000:  Miscellaneous:  Midi Menu</b>
<p>Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s).  The script is yours!!!
<br><br></font></td></tr>
<tr><td BGCOLOR=yellow ALIGN=CENTER>
<form NAME="copy">

<DIV align="center">
<input type=button value="Highlight All" onClick="javascript:this.form.txt.focus();this.form.txt.select();">&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE="text" NAME="total" VALUE="Script Size:  2.53 KB" size=24>
</DIV>

<textarea NAME="txt" ROWS=20 COLS=75 WRAP=VIRTUAL>

&lt;!-- TWO STEPS TO INSTALL MIDI MENU:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  --&gt;

&lt;!-- STEP ONE: Paste this code into the HEAD of your HTML document  --&gt;

&lt;HEAD&gt;

&lt;SCRIPT LANGUAGE="JavaScript"&gt;
&lt;!-- Original:  Nicholas Loar --&gt;
&lt;!-- Web Site:  http://www.cass.net/~anarchy --&gt;

&lt;! &gt;
&lt;! &gt;

&lt;!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "../img/midi-menu/whiskey.mid";
songNum[2] = "../img/midi-menu/aeroplane.mid";
songNum[3] = "../img/midi-menu/christina.mid";
songNum[4] = "../img/midi-menu/hell.mid";

var music = null;
var track = 0;
var ver = navigator.appName;
function audioCheck(plugName) {
for (var i = 0; i &lt; navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {
for (var j = 0; j &lt; navigator.plugins[i].length; j++) {
if (navigator.plugins[i][j].enabledPlugin) {
return true;
   }
}
return false;
   }
}
return false;
}
function chooseSong(s) { // ie
track = s.options[s.selectedIndex].value; 
if (ver == "Microsoft Internet Explorer") {
document.all.music.src = songNum[track]; 
} else {
songPlay('play');
   }
}
function songPlay(cmd) { // netscape
if (audioCheck("LiveAudio")) {
if (cmd == 'play') {
document.musicSource.play(false, songNum[track]);
   }
} else {
alert("You Do Not Have The Correct Plugin");
   }
}
//  End --&gt;
&lt;/script&gt;
&lt;/HEAD&gt;

&lt;!-- STEP TWO: Copy this code into the BODY of your HTML document  --&gt;

&lt;BODY&gt;

&lt;center&gt;
&lt;form name=choose&gt;
&lt;select size=1 name=track onChange="chooseSong(this);"&gt;
&lt;option value="0"&gt;Click For Music&lt;/option&gt;
&lt;option value="1"&gt;Whiskey In A Jar&lt;/option&gt;
&lt;option value="2"&gt;Aeroplane&lt;/option&gt;
&lt;option value="3"&gt;Genie In A Bottle&lt;/option&gt;
&lt;option value="4"&gt;Hell&lt;/option&gt;
&lt;/select&gt;
&lt;input type=button onMouseDown="chooseSong(document.choose.track)" value=" Play "&gt;
&lt;/form&gt;

&lt;script language="JavaScript"&gt;
&lt;!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('&lt;bgsound src="#" ID=music loop=1 AUTOSTART=true&gt;');
} else {
document.write('&lt;embed type="audio/midi" src="aeroplane.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND&gt;&lt;/EMBED&gt;');
}
// End --&gt;
&lt;/script&gt;
&lt;/center&gt;

 

&lt;!-- Script Size:  2.53 KB --&gt;</textarea><br><font FACE="helvetica,arial,geneva"></font></td></tr>

</table>
</form>
</FONT>
</CENTER>


</center>
</body></html>
